window.onload = function () {
    document.getElementById("communication-home").className = "add_class";
    document.getElementById("correspondence").className = "add-nav-active";
    new_message_count()
};

function new_message_count() {
    var xhr = new XMLHttpRequest();
    var local_host = window.location.host;          // 获取当前IP
    xhr.open('post', "/correspondence/not_read", true);
    xhr.setRequestHeader('content-type', 'application/x-www-form-urlencoded');
    xhr.send();
    xhr.onreadystatechange = function () {
        if (xhr.readyState === 4) {
            if (xhr.status === 200) {
                document.getElementById("loading").style.display = "none";
                var JsonData = JSON.parse(xhr.responseText);
                if (JsonData['status'] === '1'){
                    document.getElementById("communication").style = "";
                }
                // else {
                //     document.getElementById("communication").style = "display: none;";
                // }
            }
        }
    };
}
